<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateRightsEntitiesTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('rights_entities', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
            $table->bigInteger('agent_id')->default(0)->index()->comment('所属代理');
            $table->string('name', 64)->comment('实物名称');
            $table->string('logo_url', 256)->comment('图片地址');
            $table->text('description')->nullable()->comment('实物描述');
            $table->integer('exchange_count')->default(0)->comment('兑换数量');
            $table->string('status', 16)->comment('实物状态')->default(\App\Enums\ProductStatus::ON_SALE);
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('rights_entities');
    }
}
